/**
 * Arrow Functions
 * author:dengyiping
 * date:2016/08/01
 */

var f = v => v;
console.log(f("who are U"));
/* 等价于
var f = funciton(v){
    return v;
}
 */

//arrow-function Multiple parameters "()"
var soli = () => 1024 ;
//等同于 var soli = function(){ return 1024;}

var getsum = (n1,n2) => n1+n2;
console.log(getsum(1024, 500));//number
// console.log(getsum("1024", 500));//string
// console.log(getsum(1024, "500"));

//Multiple statement
var doMore = name => {
    var welc =  "Hello," + name ;
    return welc ;
}
console.log(doMore("kobe"));

//定义工具函数
const square = n => n * n;
const isEvenNum = n => n % 2 == 0;

console.log("4的平方?= " + square(4));
console.log("4 is even?= " + isEvenNum(4));
console.log("7 is even?= " + isEvenNum(7));